<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <script>
    function isHui(s) {
      const cleaned = s.toLowerCase().replace(/[^a-z0-9]/g, "");
      return cleaned === cleaned.split("").reverse().join("");
    }
    // 双指针法
    function isHui(s) {
      const cleaned = s.toLowerCase().replace(/[^a-z0-9*]/g, "");

      const left = 0;
      const right = cleaned.length - 1;

      while (left < right) {
        if (cleaned[left] !== cleaned[right]) {
          return false;
        }
        left++;
        right--;
      }

      return true;
    }
  </script>
  <body></body>
</html>
